<?php /* Smarty version 2.6.27, created on 2019-11-05 01:58:57
         compiled from usergroup/usergroup.tpl */ ?>
<?php require_once(SMARTY_CORE_DIR . 'core.load_plugins.php');
smarty_core_load_plugins(array('plugins' => array(array('modifier', 't', 'usergroup/usergroup.tpl', 4, false),)), $this); ?>
<table id="usergroup_table" style="width:100%;">
  <tr>
    <td width="40%" valign="top">
        [<a href="javascript:void(0)" onclick="add_usergroup()"><?php echo ((is_array($_tmp='添加')) ? $this->_run_mod_handler('t', true, $_tmp) : t($_tmp)); ?>
</a>]
        <table id="usergroup_list" class="itable" style="text-align:left;margin-top:15px;">
            <tr>
                <th width="30%"><?php echo ((is_array($_tmp='名称')) ? $this->_run_mod_handler('t', true, $_tmp) : t($_tmp)); ?>
</th>
                <th width="30%"><?php echo ((is_array($_tmp='描述')) ? $this->_run_mod_handler('t', true, $_tmp) : t($_tmp)); ?>
</th>
                <th width="40%"><?php echo ((is_array($_tmp='操作')) ? $this->_run_mod_handler('t', true, $_tmp) : t($_tmp)); ?>
</th>
            </tr>
            <?php $_from = $this->_tpl_vars['groupList']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['item']):
?>
            <tr>
                <td><?php echo $this->_tpl_vars['item']['name']; ?>
</td>
                <td><?php echo $this->_tpl_vars['item']['description']; ?>
</td>
                <td><a href="javascript:void(0)" onclick="edit_usergroup(<?php echo $this->_tpl_vars['item']['groupid']; ?>
)"><?php echo ((is_array($_tmp='编辑')) ? $this->_run_mod_handler('t', true, $_tmp) : t($_tmp)); ?>
</a> | 
                <a href="javascript:void(0)" onclick="delete_usergroup(<?php echo $this->_tpl_vars['item']['groupid']; ?>
)"><?php echo ((is_array($_tmp='删除')) ? $this->_run_mod_handler('t', true, $_tmp) : t($_tmp)); ?>
</a></td>
            </tr>    
            <?php endforeach; endif; unset($_from); ?>
        </table>
    </td>
    <td id="usergroup_edit_content">
    </td>
  </tr>
</table>
<select style="display:none;" id="usergroup_select">
    <option value="">请选择..</option>
    <?php $_from = $this->_tpl_vars['groupList']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['item']):
?>
        <option value="<?php echo $this->_tpl_vars['item']['groupid']; ?>
"><?php echo $this->_tpl_vars['item']['name']; ?>
</option>
    <?php endforeach; endif; unset($_from); ?>
</select>
<script type="text/javascript">
$('#usergroup_edit_content').load('admin.php?ctrl=usergroup&act=edit');
$('#usergroup_list tr:even').addClass('even');
$('#usergroup_list tr:odd').addClass('odd');
$("#usergroup_list tr").hover(
    function () {
       $(this).addClass("hover");
    },
    function () {
       $(this).removeClass("hover");
    }
);
function edit_usergroup(groupid){
	$('#usergroup_edit_content').load('admin.php?ctrl=usergroup&act=edit&groupid='+groupid);
}

function delete_usergroup(groupid){
	if(confirm('<?php echo ((is_array($_tmp='确定删除用户组?')) ? $this->_run_mod_handler('t', true, $_tmp) : t($_tmp)); ?>
')){
        $.ajax({
            type: "POST",
            url: "admin.php?ctrl=usergroup&act=delete",
            data: 'groupid='+groupid,
            timeout: 20000,
	        error: function(){$.dialog.alert('<?php echo ((is_array($_tmp='超时')) ? $this->_run_mod_handler('t', true, $_tmp) : t($_tmp)); ?>
');},
            success: function(result){
                if(result == 'success'){
                	$usergroup_tabs.tabs('load', 0);
                }else{
                    $.dialog.alert('<?php echo ((is_array($_tmp='删除失败')) ? $this->_run_mod_handler('t', true, $_tmp) : t($_tmp)); ?>
');
                }
              
            }
        });
    }
}
function add_usergroup(){
    $('#usergroup_edit_content').load('admin.php?ctrl=usergroup&act=edit');
}
</script>